a=[1.,1.,1.,1.,1.,1.,1.,1.,1.,9.0,9.,9.,9.,9.,9.,9.,9.]
avg = 0.
window = 3
for i, c in enumerate(a):
  if i<window:
    avg+=c/window
    continue
  avg-=a[i-window]/window
  avg+=c/window
  print i, avg, c, i-window
print a
